Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more GeoJSON awareness #2092

Merged
merged 3 commits into from
Jun 16, 2024
Merged

more GeoJSON awareness #2092

merged 3 commits into from
Jun 16, 2024

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Jun 16, 2024

Fixes #1745. Fixes #1172.

First, this changes the arrayify internal such that if values is a GeoJSON object, the corresponding array of features or geometries is returned. This makes GeoJSON objects usable as mark data for any mark, rather than being limited to the geo mark.

Second, this changes the field internal such that if the requested field is undefined on the given object d, it falls back to d.properties if d is a GeoJSON Feature object (d.type === "Feature"). This may have a slight performance overhead for such a core routine, but I expect the cost is negligible and I don’t think there is an alternative if we want GeoJSON to be more universally supported.

@mbostock mbostock requested a review from Fil June 16, 2024 01:38
Copy link
Contributor

@Fil Fil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combine this with #2088 and it's total map bliss!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Plot more geojson-aware Shorthand for GeoJSON properties
2 participants